idx int64 0 41.2k | question stringlengths 74 4.21k | target stringlengths 5 888 |
|---|---|---|
25,200 | public void xmlns ( Map < String , String > definition ) { Assert . notNull ( namespaceHandlerResolver , "You cannot define a Spring namespace without a [namespaceHandlerResolver] set" ) ; if ( definition . isEmpty ( ) ) { return ; } for ( Map . Entry < String , String > entry : definition . entrySet ( ) ) { String nam... | Defines a Spring namespace definition to use . |
25,201 | public void registerBeans ( BeanDefinitionRegistry registry ) { finalizeDeferredProperties ( ) ; if ( registry instanceof GenericApplicationContext ) { GenericApplicationContext ctx = ( GenericApplicationContext ) registry ; ctx . setClassLoader ( classLoader ) ; ctx . getBeanFactory ( ) . setBeanClassLoader ( classLoa... | Register a set of beans with the given bean registry . Most application contexts are bean registries . |
25,202 | public Object invokeMethod ( String name , Object arg ) { Object [ ] args = ( Object [ ] ) arg ; if ( CREATE_APPCTX . equals ( name ) ) { return createApplicationContext ( ) ; } if ( REGISTER_BEANS . equals ( name ) && args . length == 1 && args [ 0 ] instanceof GenericApplicationContext ) { registerBeans ( ( GenericAp... | Overrides method invocation to create beans for each method name that takes a class argument . |
25,203 | public void setProperty ( String name , Object value ) { if ( currentBeanConfig != null ) { setPropertyOnBeanConfig ( name , value ) ; } } | Overrides property setting in the scope of the BeanBuilder to set properties on the current BeanConfiguration . |
25,204 | @ SuppressWarnings ( "rawtypes" ) public AbstractBeanDefinition bean ( Class type , Object ... args ) { BeanConfiguration current = currentBeanConfig ; try { Closure callable = null ; Collection constructorArgs = null ; if ( args != null && args . length > 0 ) { int index = args . length ; Object lastArg = args [ index... | Defines an inner bean definition . |
25,205 | @ SuppressWarnings ( { "rawtypes" , "unchecked" } ) protected Object manageMapIfNecessary ( Object value ) { Map map = ( Map ) value ; boolean containsRuntimeRefs = false ; for ( Object e : map . values ( ) ) { if ( e instanceof RuntimeBeanReference ) { containsRuntimeRefs = true ; break ; } } if ( containsRuntimeRefs ... | Checks whether there are any runtime refs inside a Map and converts it to a ManagedMap if necessary . |
25,206 | @ SuppressWarnings ( { "rawtypes" , "unchecked" } ) protected Object manageListIfNecessary ( Object value ) { List list = ( List ) value ; boolean containsRuntimeRefs = false ; for ( Object e : list ) { if ( e instanceof RuntimeBeanReference ) { containsRuntimeRefs = true ; break ; } } if ( containsRuntimeRefs ) { List... | Checks whether there are any runtime refs inside the list and converts it to a ManagedList if necessary . |
25,207 | private void loadDelayedPlugins ( ) { while ( ! delayedLoadPlugins . isEmpty ( ) ) { GrailsPlugin plugin = delayedLoadPlugins . remove ( 0 ) ; if ( areDependenciesResolved ( plugin ) ) { if ( ! hasValidPluginsToLoadBefore ( plugin ) ) { registerPlugin ( plugin ) ; } else { delayedLoadPlugins . add ( plugin ) ; } } else... | This method will attempt to load that plug - ins not loaded in the first pass |
25,208 | private boolean isDependentOn ( GrailsPlugin plugin , GrailsPlugin dependency ) { for ( String name : plugin . getDependencyNames ( ) ) { String requiredVersion = plugin . getDependentVersion ( name ) ; if ( name . equals ( dependency . getName ( ) ) && GrailsVersionUtils . isValidVersion ( dependency . getVersion ( ) ... | Checks whether the first plugin is dependant on the second plugin . |
25,209 | private boolean areNoneToLoadBefore ( GrailsPlugin plugin ) { for ( String name : plugin . getLoadAfterNames ( ) ) { if ( getGrailsPlugin ( name ) == null ) { return false ; } } return true ; } | Returns true if there are no plugins left that should if possible be loaded before this plugin . |
25,210 | private void attemptPluginLoad ( GrailsPlugin plugin ) { if ( areDependenciesResolved ( plugin ) && areNoneToLoadBefore ( plugin ) ) { registerPlugin ( plugin ) ; } else { delayedLoadPlugins . add ( plugin ) ; } } | Attempts to load a plugin based on its dependencies . If a plugin s dependencies cannot be resolved it will add it to the list of dependencies to be resolved later . |
25,211 | public Date getDate ( String name ) { Object returnValue = wrappedMap . get ( name ) ; if ( "date.struct" . equals ( returnValue ) ) { returnValue = lazyEvaluateDateParam ( name ) ; nestedDateMap . put ( name , returnValue ) ; return ( Date ) returnValue ; } Date date = super . getDate ( name ) ; if ( date == null ) { ... | Obtains a date for the parameter name using the default format |
25,212 | public String toQueryString ( ) { String encoding = request . getCharacterEncoding ( ) ; try { return WebUtils . toQueryString ( this , encoding ) ; } catch ( UnsupportedEncodingException e ) { throw new ControllerExecutionException ( "Unable to convert parameter map [" + this + "] to a query string: " + e . getMessage... | Converts this parameter map into a query String . Note that this will flatten nested keys separating them with the . character and URL encode the result |
25,213 | protected void validateLogoutRequest ( final LogoutRequest logoutRequest , final SAML2MessageContext context , final SignatureTrustEngine engine ) { validateSignatureIfItExists ( logoutRequest . getSignature ( ) , context , engine ) ; validateIssuerIfItExists ( logoutRequest . getIssuer ( ) , context ) ; NameID nameId ... | Validates the SAML logout request . |
25,214 | protected void validateLogoutResponse ( final LogoutResponse logoutResponse , final SAML2MessageContext context , final SignatureTrustEngine engine ) { validateSuccess ( logoutResponse . getStatus ( ) ) ; validateSignatureIfItExists ( logoutResponse . getSignature ( ) , context , engine ) ; validateIssueInstant ( logou... | Validates the SAML logout response . |
25,215 | public static boolean isGet ( final WebContext context ) { return HttpConstants . HTTP_METHOD . GET . name ( ) . equalsIgnoreCase ( context . getRequestMethod ( ) ) ; } | Whether it is a GET request . |
25,216 | public static boolean isPost ( final WebContext context ) { return HttpConstants . HTTP_METHOD . POST . name ( ) . equalsIgnoreCase ( context . getRequestMethod ( ) ) ; } | Whether it is a POST request . |
25,217 | public static boolean isPut ( final WebContext context ) { return HttpConstants . HTTP_METHOD . PUT . name ( ) . equalsIgnoreCase ( context . getRequestMethod ( ) ) ; } | Whether it is a PUT request . |
25,218 | public static boolean isPatch ( final WebContext context ) { return HttpConstants . HTTP_METHOD . PATCH . name ( ) . equalsIgnoreCase ( context . getRequestMethod ( ) ) ; } | Whether it is a PATCH request . |
25,219 | public static boolean isDelete ( final WebContext context ) { return HttpConstants . HTTP_METHOD . DELETE . name ( ) . equalsIgnoreCase ( context . getRequestMethod ( ) ) ; } | Whether it is a DELETE request . |
25,220 | protected final void validateSuccess ( final Status status ) { String statusValue = status . getStatusCode ( ) . getValue ( ) ; if ( ! StatusCode . SUCCESS . equals ( statusValue ) ) { final StatusMessage statusMessage = status . getStatusMessage ( ) ; if ( statusMessage != null ) { statusValue += " / " + statusMessage... | Validates that the response is a success . |
25,221 | protected final void validateSignature ( final Signature signature , final String idpEntityId , final SignatureTrustEngine trustEngine ) { final SAMLSignatureProfileValidator validator = new SAMLSignatureProfileValidator ( ) ; try { validator . validate ( signature ) ; } catch ( final SignatureException e ) { throw new... | Validate the given digital signature by checking its profile and value . |
25,222 | protected final void validateIssuer ( final Issuer issuer , final SAML2MessageContext context ) { if ( issuer . getFormat ( ) != null && ! issuer . getFormat ( ) . equals ( NameIDType . ENTITY ) ) { throw new SAMLIssuerException ( "Issuer type is not entity but " + issuer . getFormat ( ) ) ; } final String entityId = c... | Validate issuer format and value . |
25,223 | protected final NameID decryptEncryptedId ( final EncryptedID encryptedId , final Decrypter decrypter ) throws SAMLException { if ( encryptedId == null ) { return null ; } if ( decrypter == null ) { logger . warn ( "Encrypted attributes returned, but no keystore was provided." ) ; return null ; } try { final NameID dec... | Decrypts an EncryptedID using a decrypter . |
25,224 | protected void populateVelocityContext ( VelocityContext velocityContext , MessageContext < SAMLObject > messageContext , String endpointURL ) throws MessageEncodingException { String encodedEndpointURL = HTMLEncoder . encodeForHTMLAttribute ( endpointURL ) ; log . debug ( "Encoding action url of '{}' with encoded valu... | Populate the Velocity context instance which will be used to render the POST body . |
25,225 | protected Element marshallMessage ( XMLObject message ) throws MessageEncodingException { log . debug ( "Marshalling message" ) ; try { return XMLObjectSupport . marshall ( message ) ; } catch ( MarshallingException e ) { throw new MessageEncodingException ( "Error marshalling message" , e ) ; } } | Helper method that marshalls the given message . |
25,226 | public List < U > getAll ( final boolean readFromSession ) { final LinkedHashMap < String , U > profiles = retrieveAll ( readFromSession ) ; return ProfileHelper . flatIntoAProfileList ( profiles ) ; } | Retrieve all user profiles . |
25,227 | protected LinkedHashMap < String , U > retrieveAll ( final boolean readFromSession ) { final LinkedHashMap < String , U > profiles = new LinkedHashMap < > ( ) ; this . context . getRequestAttribute ( Pac4jConstants . USER_PROFILES ) . ifPresent ( request -> { if ( request instanceof LinkedHashMap ) { profiles . putAll ... | Retrieve the map of profiles from the session or the request . |
25,228 | public Object prepare ( final Object value ) { if ( value == null || value instanceof String || ! stringify ) { return value ; } else { if ( value instanceof Boolean ) { return PREFIX_BOOLEAN . concat ( value . toString ( ) ) ; } else if ( value instanceof Integer ) { return PREFIX_INT . concat ( value . toString ( ) )... | Before saving the attribute into the attributes map . |
25,229 | public Object restore ( final Object value ) { if ( value != null && value instanceof String ) { final String sValue = ( String ) value ; if ( sValue . startsWith ( PREFIX ) ) { if ( sValue . startsWith ( PREFIX_BOOLEAN ) ) { return Boolean . parseBoolean ( sValue . substring ( PREFIX_BOOLEAN . length ( ) ) ) ; } else ... | After retrieving the attribute from the attributes map . |
25,230 | public static EntryResolver newSearchEntryResolver ( final LdapAuthenticationProperties l ) { final PooledSearchEntryResolver entryResolver = new PooledSearchEntryResolver ( ) ; entryResolver . setBaseDn ( l . getBaseDn ( ) ) ; entryResolver . setUserFilter ( l . getUserFilter ( ) ) ; entryResolver . setSubtreeSearch (... | New dn resolver entry resolver . |
25,231 | public S buildService ( final WebContext context , final IndirectClient client , final String state ) { init ( ) ; final String finalCallbackUrl = client . computeFinalCallbackUrl ( context ) ; return getApi ( ) . createService ( this . key , this . secret , finalCallbackUrl , this . scope , null , state , this . respo... | Build an OAuth service from the web context and with a state . |
25,232 | public boolean isAllAuthorized ( final WebContext context , final List < U > profiles ) { for ( final U profile : profiles ) { if ( ! isProfileAuthorized ( context , profile ) ) { return handleError ( context ) ; } } return true ; } | If all profiles are authorized . |
25,233 | protected void populateBindingContext ( final SAML2MessageContext messageContext ) { SAMLBindingContext bindingContext = messageContext . getSubcontext ( SAMLBindingContext . class , true ) ; bindingContext . setBindingUri ( getBindingURI ( messageContext ) ) ; bindingContext . setHasBindingSignature ( false ) ; bindin... | Populate the context which carries information specific to this binding . |
25,234 | protected XMLObject unmarshallMessage ( InputStream messageStream ) throws MessageDecodingException { try { XMLObject message = XMLObjectSupport . unmarshallFromInputStream ( getParserPool ( ) , messageStream ) ; return message ; } catch ( XMLParserException e ) { throw new MessageDecodingException ( "Error unmarshalli... | Helper method that deserializes and unmarshalls the message from the given stream . |
25,235 | protected Map < String , Object > convertProfileAndPasswordToAttributes ( final U profile , final String password ) { final Map < String , Object > storageAttributes = new HashMap < > ( ) ; storageAttributes . put ( getIdAttribute ( ) , profile . getId ( ) ) ; storageAttributes . put ( LINKEDID , profile . getLinkedId ... | Convert a profile and a password into a map of attributes for the storage . |
25,236 | protected List < String > defineAttributesToRead ( ) { final List < String > names = new ArrayList < > ( ) ; names . add ( getIdAttribute ( ) ) ; names . add ( LINKEDID ) ; if ( isLegacyMode ( ) ) { names . add ( getUsernameAttribute ( ) ) ; names . addAll ( Arrays . asList ( attributeNames ) ) ; } else { names . add (... | Define the attributes to read in the storage . |
25,237 | protected U convertAttributesToProfile ( final List < Map < String , Object > > listStorageAttributes , final String username ) { if ( listStorageAttributes == null || listStorageAttributes . size ( ) == 0 ) { return null ; } final Map < String , Object > storageAttributes = listStorageAttributes . get ( 0 ) ; final St... | Convert the list of map of attributes from the storage into a profile . |
25,238 | public static RedirectionAction buildRedirectUrlAction ( final WebContext context , final String location ) { if ( ContextHelper . isPost ( context ) && useModernHttpCodes ) { return new SeeOtherAction ( location ) ; } else { return new FoundAction ( location ) ; } } | Build the appropriate redirection action for a location . |
25,239 | public static RedirectionAction buildFormPostContentAction ( final WebContext context , final String content ) { if ( ContextHelper . isPost ( context ) && useModernHttpCodes ) { return new TemporaryRedirectAction ( content ) ; } else { return new OkAction ( content ) ; } } | Build the appropriate redirection action for a content which is a form post . |
25,240 | public static String buildFormPostContent ( final WebContext context ) { final String requestedUrl = context . getFullRequestURL ( ) ; final Map < String , String [ ] > parameters = context . getRequestParameters ( ) ; final StringBuilder buffer = new StringBuilder ( ) ; buffer . append ( "<html>\n" ) ; buffer . append... | Build a form POST content from the web context . |
25,241 | public void convertAndAdd ( final CommonProfile profile , final AttributeLocation attributeLocation , final String name , final Object value ) { if ( value != null ) { final Object convertedValue ; final AttributeConverter < ? extends Object > converter = this . converters . get ( name ) ; if ( converter != null ) { co... | Convert a profile or authentication attribute if necessary and add it to the profile . |
25,242 | public void convertAndAdd ( final CommonProfile profile , final Map < String , Object > profileAttributes , final Map < String , Object > authenticationAttributes ) { if ( profileAttributes != null ) { profileAttributes . entrySet ( ) . stream ( ) . forEach ( entry -> convertAndAdd ( profile , PROFILE_ATTRIBUTE , entry... | Convert the profile and authentication attributes if necessary and add them to the profile . |
25,243 | protected void setProfileFactory ( final Function < Object [ ] , P > profileFactory ) { CommonHelper . assertNotNull ( "profileFactory" , profileFactory ) ; this . newProfile = profileFactory ; } | Define the way to build the profile . |
25,244 | protected void secondary ( final String name , final AttributeConverter < ? extends Object > converter ) { secondaries . add ( name ) ; converters . put ( name , converter ) ; } | Add an attribute as a secondary one and its converter . |
25,245 | protected void removeSignature ( SAMLObject message ) { if ( message instanceof SignableSAMLObject ) { final SignableSAMLObject signableMessage = ( SignableSAMLObject ) message ; if ( signableMessage . isSigned ( ) ) { log . debug ( "Removing SAML protocol message signature" ) ; signableMessage . setSignature ( null ) ... | Removes the signature from the protocol message . |
25,246 | protected String buildRedirectURL ( MessageContext < SAMLObject > messageContext , String endpoint , String message ) throws MessageEncodingException { log . debug ( "Building URL to redirect client to" ) ; URLBuilder urlBuilder ; try { urlBuilder = new URLBuilder ( endpoint ) ; } catch ( MalformedURLException e ) { th... | Builds the URL to redirect the client to . |
25,247 | protected String getSignatureAlgorithmURI ( SignatureSigningParameters signingParameters ) throws MessageEncodingException { if ( signingParameters . getSignatureAlgorithm ( ) != null ) { return signingParameters . getSignatureAlgorithm ( ) ; } throw new MessageEncodingException ( "The signing algorithm URI could not b... | Gets the signature algorithm URI to use . |
25,248 | protected String generateSignature ( Credential signingCredential , String algorithmURI , String queryString ) throws MessageEncodingException { log . debug ( String . format ( "Generating signature with key type '%s', algorithm URI '%s' over query string '%s'" , CredentialSupport . extractSigningKey ( signingCredentia... | Generates the signature over the query string . |
25,249 | public static JsonNode getFirstNode ( final String text , final String path ) { try { JsonNode node = mapper . readValue ( text , JsonNode . class ) ; if ( path != null ) { node = ( JsonNode ) getElement ( node , path ) ; } return node ; } catch ( final IOException e ) { logger . error ( "Cannot get first node" , e ) ;... | Return the first node of a JSON response . |
25,250 | public static Object getElement ( final JsonNode json , final String name ) { if ( json != null && name != null ) { JsonNode node = json ; for ( String nodeName : name . split ( "\\." ) ) { if ( node != null ) { if ( nodeName . matches ( "\\d+" ) ) { node = node . get ( Integer . parseInt ( nodeName ) ) ; } else { node... | Return the field with name in JSON as a string a boolean a number or a node . |
25,251 | public static String toJSONString ( final Object obj ) { try { return mapper . writeValueAsString ( obj ) ; } catch ( final JsonProcessingException e ) { logger . error ( "Cannot to JSON string" , e ) ; } return null ; } | Returns the JSON string for the object . |
25,252 | private X509Certificate createSelfSignedCert ( X500Name dn , String sigName , AlgorithmIdentifier sigAlgID , KeyPair keyPair ) throws Exception { final V3TBSCertificateGenerator certGen = new V3TBSCertificateGenerator ( ) ; certGen . setSerialNumber ( new ASN1Integer ( BigInteger . valueOf ( 1 ) ) ) ; certGen . setIssu... | Generate a self - signed certificate for dn using the provided signature algorithm and key pair . |
25,253 | public byte [ ] serializeToBytes ( final Serializable o ) { byte [ ] bytes = null ; try ( final ByteArrayOutputStream baos = new ByteArrayOutputStream ( ) ; final ObjectOutputStream oos = new ObjectOutputStream ( baos ) ) { oos . writeObject ( o ) ; oos . flush ( ) ; bytes = baos . toByteArray ( ) ; } catch ( final IOE... | Serialize a Java object into a bytes array . |
25,254 | public Serializable deserializeFromBytes ( final byte [ ] bytes ) { Serializable o = null ; try ( final ByteArrayInputStream bais = new ByteArrayInputStream ( bytes ) ; final ObjectInputStream ois = new RestrictedObjectInputStream ( bais , this . trustedPackages , this . trustedClasses ) ) { o = ( Serializable ) ois . ... | Deserialize a bytes array into a Java object . |
25,255 | public static String addParameter ( final String url , final String name , final String value ) { if ( url != null ) { final StringBuilder sb = new StringBuilder ( ) ; sb . append ( url ) ; if ( name != null ) { if ( url . indexOf ( "?" ) >= 0 ) { sb . append ( "&" ) ; } else { sb . append ( "?" ) ; } sb . append ( nam... | Add a new parameter to an url . |
25,256 | public static String urlEncode ( final String text ) { try { return URLEncoder . encode ( text , StandardCharsets . UTF_8 . name ( ) ) ; } catch ( final UnsupportedEncodingException e ) { final String message = "Unable to encode text : " + text ; throw new TechnicalException ( message , e ) ; } } | URL encode a text using UTF - 8 . |
25,257 | public static String toNiceString ( final Class < ? > clazz , final Object ... args ) { final StringBuilder sb = new StringBuilder ( ) ; sb . append ( "#" ) ; sb . append ( clazz . getSimpleName ( ) ) ; sb . append ( "# |" ) ; boolean b = true ; for ( final Object arg : args ) { if ( b ) { sb . append ( " " ) ; sb . ap... | Build a nice toString for an object . |
25,258 | public static String randomString ( final int size ) { final StringBuilder builder = new StringBuilder ( ) ; while ( builder . length ( ) < size ) { final String suffix = java . util . UUID . randomUUID ( ) . toString ( ) . replace ( "-" , "" ) ; builder . append ( suffix ) ; } return builder . substring ( 0 , size ) ;... | Return a random string of a certain size . |
25,259 | public static Date newDate ( final Date original ) { return original != null ? new Date ( original . getTime ( ) ) : null ; } | Copy a date . |
25,260 | public static URI asURI ( final String s ) { try { return new URI ( s ) ; } catch ( final URISyntaxException e ) { throw new TechnicalException ( "Cannot make an URI from: " + s , e ) ; } } | Convert a string into an URI . |
25,261 | public static Constructor getConstructor ( final String name ) throws ClassNotFoundException , NoSuchMethodException { Constructor constructor = constructorsCache . get ( name ) ; if ( constructor == null ) { synchronized ( constructorsCache ) { constructor = constructorsCache . get ( name ) ; if ( constructor == null ... | Get the constructor of the class . |
25,262 | public void build ( final Object id , final Map < String , Object > attributes ) { setId ( ProfileHelper . sanitizeIdentifier ( this , id ) ) ; addAttributes ( attributes ) ; } | Build a profile from user identifier and attributes . |
25,263 | public void build ( final Object id , final Map < String , Object > attributes , final Map < String , Object > authenticationAttributes ) { build ( id , attributes ) ; addAuthenticationAttributes ( authenticationAttributes ) ; } | Build a profile from user identifier attributes and authentication attributes . |
25,264 | public void addAuthenticationAttributes ( Map < String , Object > attributeMap ) { if ( attributeMap != null ) { for ( final Map . Entry < String , Object > entry : attributeMap . entrySet ( ) ) { addAuthenticationAttribute ( entry . getKey ( ) , entry . getValue ( ) ) ; } } } | Add authentication attributes . |
25,265 | public Object getAttribute ( final String name ) { return ProfileHelper . getInternalAttributeHandler ( ) . restore ( this . attributes . get ( name ) ) ; } | Return the attribute with name . |
25,266 | public Object getAuthenticationAttribute ( final String name ) { return ProfileHelper . getInternalAttributeHandler ( ) . restore ( this . authenticationAttributes . get ( name ) ) ; } | Return the authentication attribute with name . |
25,267 | public boolean containsAttribute ( final String name ) { CommonHelper . assertNotNull ( "name" , name ) ; return this . attributes . containsKey ( name ) ; } | Check to see if profile contains attribute name . |
25,268 | public < T > T getAuthenticationAttribute ( final String name , final Class < T > clazz ) { final Object attribute = getAuthenticationAttribute ( name ) ; return getAttributeByType ( name , clazz , attribute ) ; } | Return authentication attribute with name |
25,269 | public void addRole ( final String role ) { CommonHelper . assertNotBlank ( "role" , role ) ; this . roles . add ( role ) ; } | Add a role . |
25,270 | public void addRoles ( final Collection < String > roles ) { CommonHelper . assertNotNull ( "roles" , roles ) ; this . roles . addAll ( roles ) ; } | Add roles . |
25,271 | public void addPermission ( final String permission ) { CommonHelper . assertNotBlank ( "permission" , permission ) ; this . permissions . add ( permission ) ; } | Add a permission . |
25,272 | public void addPermissions ( final Collection < String > permissions ) { CommonHelper . assertNotNull ( "permissions" , permissions ) ; this . permissions . addAll ( permissions ) ; } | Add permissions . |
25,273 | public boolean mustLoadProfilesFromSession ( final C context , final List < Client > currentClients ) { return isEmpty ( currentClients ) || currentClients . get ( 0 ) instanceof IndirectClient || currentClients . get ( 0 ) instanceof AnonymousClient ; } | Load the profiles from the web session if no clients are defined or if the first client is an indirect one or if the first client is the anonymous one . |
25,274 | public boolean mustSaveProfileInSession ( final C context , final List < Client > currentClients , final DirectClient directClient , final UserProfile profile ) { return false ; } | Never save the profile in session after a direct client authentication . |
25,275 | protected void updateIndirectClient ( final IndirectClient client ) { if ( this . callbackUrl != null && client . getCallbackUrl ( ) == null ) { client . setCallbackUrl ( this . callbackUrl ) ; } if ( this . urlResolver != null && client . getUrlResolver ( ) == null ) { client . setUrlResolver ( this . urlResolver ) ; ... | Setup the indirect client . |
25,276 | public Optional < Client > findClient ( final String name ) { CommonHelper . assertNotBlank ( "name" , name ) ; init ( ) ; final String lowerTrimmedName = name . toLowerCase ( ) . trim ( ) ; final Client client = _clients . get ( lowerTrimmedName ) ; if ( client != null ) { return Optional . of ( client ) ; } LOGGER . ... | Return the right client according to the specific name . |
25,277 | @ SuppressWarnings ( "unchecked" ) public < C extends Client > Optional < C > findClient ( final Class < C > clazz ) { CommonHelper . assertNotNull ( "clazz" , clazz ) ; init ( ) ; if ( clazz != null ) { for ( final Client client : getClients ( ) ) { if ( clazz . isAssignableFrom ( client . getClass ( ) ) ) { return Op... | Return the right client according to the specific class . |
25,278 | protected String getSessionIndex ( final Assertion subjectAssertion ) { List < AuthnStatement > authnStatements = subjectAssertion . getAuthnStatements ( ) ; if ( authnStatements != null && authnStatements . size ( ) > 0 ) { AuthnStatement statement = authnStatements . get ( 0 ) ; if ( statement != null ) { return stat... | Searches the sessionIndex in the assertion |
25,279 | protected final void decryptEncryptedAssertions ( final Response response , final Decrypter decrypter ) { for ( final EncryptedAssertion encryptedAssertion : response . getEncryptedAssertions ( ) ) { try { final Assertion decryptedAssertion = decrypter . decrypt ( encryptedAssertion ) ; response . getAssertions ( ) . a... | Decrypt encrypted assertions and add them to the assertions list of the response . |
25,280 | protected final boolean isValidBearerSubjectConfirmationData ( final SubjectConfirmationData data , final SAML2MessageContext context ) { if ( data == null ) { logger . debug ( "SubjectConfirmationData cannot be null for Bearer confirmation" ) ; return false ; } if ( data . getNotBefore ( ) != null ) { logger . debug (... | Validate Bearer subject confirmation data - notBefore - NotOnOrAfter - recipient |
25,281 | protected final void validateAssertionConditions ( final Conditions conditions , final SAML2MessageContext context ) { if ( conditions == null ) { return ; } if ( conditions . getNotBefore ( ) != null && conditions . getNotBefore ( ) . minusSeconds ( acceptedSkew ) . isAfterNow ( ) ) { throw new SAMLAssertionConditionE... | Validate assertionConditions - notBefore - notOnOrAfter |
25,282 | protected final void validateAudienceRestrictions ( final List < AudienceRestriction > audienceRestrictions , final String spEntityId ) { if ( audienceRestrictions == null || audienceRestrictions . isEmpty ( ) ) { throw new SAMLAssertionAudienceException ( "Audience restrictions cannot be null or empty" ) ; } final Set... | Validate audience by matching the SP entityId . |
25,283 | protected final void validateAssertionSignature ( final Signature signature , final SAML2MessageContext context , final SignatureTrustEngine engine ) { final SAMLPeerEntityContext peerContext = context . getSAMLPeerEntityContext ( ) ; if ( signature != null ) { final String entityId = peerContext . getEntityId ( ) ; va... | Validate assertion signature . If none is found and the SAML response did not have one and the SP requires the assertions to be signed the validation fails . |
25,284 | public void set ( final String messageID , final XMLObject message ) { log . debug ( "Storing message {} to session {}" , messageID , context . getSessionStore ( ) . getOrCreateSessionId ( context ) ) ; final LinkedHashMap < String , XMLObject > messages = getMessages ( ) ; messages . put ( messageID , message ) ; upda... | Stores a request message into the repository . RequestAbstractType must have an ID set . Any previous message with the same ID will be overwritten . |
25,285 | private void updateSession ( final LinkedHashMap < String , XMLObject > messages ) { context . getSessionStore ( ) . set ( context , SAML_STORAGE_KEY , messages ) ; } | Updates session with the internalMessages key . Some application servers require session value to be updated in order to replicate the session across nodes or persist it correctly . |
25,286 | public String getProxyTicketFor ( final String service ) { if ( this . attributePrincipal != null ) { logger . debug ( "Requesting PT from principal: {} and for service: {}" , attributePrincipal , service ) ; final String pt = this . attributePrincipal . getProxyTicketFor ( service ) ; logger . debug ( "Get PT: {}" , p... | Get a proxy ticket for a given service . |
25,287 | protected Optional < C > retrieveCredentials ( final WebContext context ) { try { final Optional < C > optCredentials = this . credentialsExtractor . extract ( context ) ; optCredentials . ifPresent ( credentials -> { final long t0 = System . currentTimeMillis ( ) ; try { this . authenticator . validate ( credentials ,... | Retrieve the credentials . |
25,288 | protected final Optional < UserProfile > retrieveUserProfile ( final C credentials , final WebContext context ) { final Optional < UserProfile > profile = this . profileCreator . create ( credentials , context ) ; logger . debug ( "profile: {}" , profile ) ; return profile ; } | Retrieve a user profile . |
25,289 | protected HttpAction forbidden ( final C context , final List < Client > currentClients , final List < UserProfile > profiles , final String authorizers ) { return ForbiddenAction . INSTANCE ; } | Return a forbidden error . |
25,290 | protected boolean startAuthentication ( final C context , final List < Client > currentClients ) { return isNotEmpty ( currentClients ) && currentClients . get ( 0 ) instanceof IndirectClient ; } | Return whether we must start a login process if the first client is an indirect one . |
25,291 | protected void saveRequestedUrl ( final C context , final List < Client > currentClients , AjaxRequestResolver ajaxRequestResolver ) { if ( ajaxRequestResolver == null || ! ajaxRequestResolver . isAjax ( context ) ) { savedRequestHandler . save ( context ) ; } } | Save the requested url . |
25,292 | protected HttpAction redirectToIdentityProvider ( final C context , final List < Client > currentClients ) { final IndirectClient currentClient = ( IndirectClient ) currentClients . get ( 0 ) ; return ( HttpAction ) currentClient . redirect ( context ) . get ( ) ; } | Perform a redirection to start the login process of the first indirect client . |
25,293 | public Gender getGender ( ) { final Gender gender = ( Gender ) getAttribute ( CommonProfileDefinition . GENDER ) ; if ( gender == null ) { return Gender . UNSPECIFIED ; } else { return gender ; } } | Return the gender of the user . |
25,294 | protected Optional < DigestCredentials > retrieveCredentials ( final WebContext context ) { final String nonce = calculateNonce ( ) ; context . setResponseHeader ( HttpConstants . AUTHENTICATE_HEADER , "Digest realm=\"" + realm + "\", qop=\"auth\", nonce=\"" + nonce + "\"" ) ; return super . retrieveCredentials ( conte... | Per RFC 2617 If a server receives a request for an access - protected object and an acceptable Authorization header is not sent the server responds with a 401 Unauthorized status code and a WWW - Authenticate header |
25,295 | public String calculateServerDigest ( boolean passwordAlreadyEncoded , String password ) { return generateDigest ( passwordAlreadyEncoded , username , realm , password , httpMethod , uri , qop , nonce , nc , cnonce ) ; } | This calculates the server digest value based on user stored password . If the server stores password in clear format then passwordAlreadyEncoded should be false . If the server stores the password in ha1 digest then the passwordAlreadyEncoded should be true . |
25,296 | private String generateDigest ( boolean passwordAlreadyEncoded , String username , String realm , String password , String httpMethod , String uri , String qop , String nonce , String nc , String cnonce ) { String ha1 ; String a2 = httpMethod + ":" + uri ; String ha2 = CredentialUtil . encryptMD5 ( a2 ) ; if ( password... | generate digest token based on RFC 2069 and RFC 2617 guidelines |
25,297 | protected Optional < UserProfile > retrieveUserProfileFromToken ( final WebContext context , final T accessToken ) { final OAuthProfileDefinition < U , T , O > profileDefinition = configuration . getProfileDefinition ( ) ; final String profileUrl = profileDefinition . getProfileUrl ( accessToken , configuration ) ; fin... | Retrieve the user profile from the access token . |
25,298 | protected String sendRequestForData ( final S service , final T accessToken , final String dataUrl , Verb verb ) { logger . debug ( "accessToken: {} / dataUrl: {}" , accessToken , dataUrl ) ; final long t0 = System . currentTimeMillis ( ) ; final OAuthRequest request = createOAuthRequest ( dataUrl , verb ) ; signReques... | Make a request to get the data of the authenticated user for the provider . |
25,299 | protected String addExchangeToken ( final String url , final OAuth2AccessToken accessToken ) { final FacebookProfileDefinition profileDefinition = ( FacebookProfileDefinition ) configuration . getProfileDefinition ( ) ; final FacebookConfiguration facebookConfiguration = ( FacebookConfiguration ) configuration ; String... | Adds the token to the URL in question . If we require appsecret_proof then this method will also add the appsecret_proof parameter to the URL as Facebook expects . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.