@Override public Credentials doXML( XMLStreamReader xmlStream, HttpServletRequest req, HttpServletResponse response ) throws SecurityException { // extract (deegree specific) security information and bind to current thread String user = xmlStream.getAttributeValue( "", "user" ); String password = xmlStream.getAttributeValue( "", "password" ); String tokenId = xmlStream.getAttributeValue( "", "sessionId" ); return new Credentials( user, password, tokenId ); }
stmt.setString( 1, ss[0] ); stmt.setString( 2, ss[1] ); stmt.setString( 3, creds.getUser() ); stmt.setTimestamp( 4, new Timestamp( startTime ) ); stmt.setTimestamp( 5, new Timestamp( endTime ) );
stmt.setString( 1, ss[0] ); stmt.setString( 2, ss[1] ); stmt.setString( 3, creds.getUser() ); stmt.setTimestamp( 4, new Timestamp( startTime ) ); stmt.setTimestamp( 5, new Timestamp( endTime ) );
@Override public Credentials doKVP( Map<String, String> normalizedKVPParams, HttpServletRequest req, HttpServletResponse response ) throws SecurityException { // extract (deegree specific) security information and bind to current thread String user = normalizedKVPParams.get( "USER" ); String password = normalizedKVPParams.get( "PASSWORD" ); String tokenId = normalizedKVPParams.get( "SESSIONID" ); return new Credentials( user, password, tokenId ); }
/** * Swapped method to provide the basic authentication. * * @param req * @param response */ private Credentials doBasicAuthentication( HttpServletRequest req, HttpServletResponse response ) { // look for HTTP Basic Authentification info LOG.debug( "header: " + req.getHeader( "authorization" ) ); String authorizationHeader = req.getHeader( "authorization" ); if ( authorizationHeader != null ) { if ( authorizationHeader.startsWith( "Basic " ) || authorizationHeader.startsWith( "BASIC " ) ) { LOG.debug( "Found basic authorization header: '" + authorizationHeader + "'." ); // 6: length of "Basic " String encodedCreds = authorizationHeader.substring( 6 ).trim(); LOG.debug( "encodedCreds: " + encodedCreds ); String creds = new String( Base64.decodeBase64( encodedCreds ) ); LOG.debug( "creds: " + creds ); int delimPos = creds.indexOf( ':' ); if ( delimPos != -1 ) { String user = creds.substring( 0, delimPos ); String password = creds.substring( delimPos + 1 ); LOG.debug( "user: " + user ); LOG.debug( "password: " + password ); return new Credentials( user, password ); } } } return null; }
@Override public Credentials doSOAP( SOAPEnvelope soapDoc, HttpServletRequest req ) throws SecurityException { OMElement requestHeader = soapDoc.getHeader(); SoapHeaderXMLAdapter soapXMLHeader = new SoapHeaderXMLAdapter(); soapXMLHeader.setRootElement( requestHeader ); SoapHeader soapHeader = soapXMLHeader.parseHeader(); LOG.info( soapHeader.getUsername() + " " + soapHeader.getPassword() ); return new Credentials( soapHeader.getUsername(), soapHeader.getPassword() ); }