idx
int64
0
41.2k
question
stringlengths
73
5.81k
target
stringlengths
5
918
17,900
@ ShellMethod ( key = "generate-anonymous-user" , value = "Generate an anonymous (persistent) username identifier" ) public void generateUsername ( @ ShellOption ( value = { "username" } , help = "Authenticated username" ) final String username , @ ShellOption ( value = { "service" } , help = "Service application URL f...
Generate username .
17,901
public void clean ( ) { val now = ZonedDateTime . now ( ) ; LOGGER . debug ( "Starting to clean previously used authenticator tokens from [{}] at [{}]" , this . tokenRepository , now ) ; tokenRepository . clean ( ) ; LOGGER . info ( "Finished cleaning authenticator tokens at [{}]" , now ) ; }
Clean the repository .
17,902
protected ModelAndView redirectToApproveView ( final J2EContext ctx , final OAuthRegisteredService svc ) { val callbackUrl = ctx . getFullRequestURL ( ) ; LOGGER . trace ( "callbackUrl: [{}]" , callbackUrl ) ; val url = new URIBuilder ( callbackUrl ) ; url . addParameter ( OAuth20Constants . BYPASS_APPROVAL_PROMPT , Bo...
Redirect to approve view model and view .
17,903
public static void generateQRCode ( final OutputStream stream , final String key , final int width , final int height ) { val hintMap = new EnumMap < EncodeHintType , Object > ( EncodeHintType . class ) ; hintMap . put ( EncodeHintType . CHARACTER_SET , StandardCharsets . UTF_8 . name ( ) ) ; hintMap . put ( EncodeHint...
Generate qr code .
17,904
protected AuthenticationHandlerExecutionResult createResult ( final ClientCredential credentials , final UserProfile profile , final BaseClient client ) throws GeneralSecurityException { if ( profile == null ) { throw new FailedLoginException ( "Authentication did not produce a user profile for: " + credentials ) ; } v...
Build the handler result .
17,905
protected AuthenticationHandlerExecutionResult finalizeAuthenticationHandlerResult ( final ClientCredential credentials , final Principal principal , final UserProfile profile , final BaseClient client ) { preFinalizeAuthenticationHandlerResult ( credentials , principal , profile , client ) ; return createHandlerResult...
Finalize authentication handler result .
17,906
protected String determinePrincipalIdFrom ( final UserProfile profile , final BaseClient client ) { var id = profile . getId ( ) ; val properties = client != null ? client . getCustomProperties ( ) : new HashMap < > ( ) ; if ( client != null && properties . containsKey ( ClientCustomPropertyConstants . CLIENT_CUSTOM_PR...
Determine principal id from profile .
17,907
protected void validateCredentials ( final UsernamePasswordCredentials credentials , final OAuthRegisteredService registeredService , final WebContext context ) { if ( ! OAuth20Utils . checkClientSecret ( registeredService , credentials . getPassword ( ) ) ) { throw new CredentialsException ( "Bad secret for client ide...
Validate credentials .
17,908
protected String buildSingleAttributeDefinitionLine ( final String attributeName , final Object value ) { return new StringBuilder ( ) . append ( "<cas:" . concat ( attributeName ) . concat ( ">" ) ) . append ( encodeAttributeValue ( value ) ) . append ( "</cas:" . concat ( attributeName ) . concat ( ">" ) ) . toString...
Build single attribute definition line .
17,909
@ View ( name = "by_username" , map = "function(doc) { if(doc.publicId && doc.username) {emit(doc.username, doc)}}" ) public YubiKeyAccount findByUsername ( final String uid ) { val view = createQuery ( "by_username" ) . key ( uid ) . limit ( 1 ) . includeDocs ( true ) ; return db . queryView ( view , CouchDbYubiKeyAcc...
Find by username .
17,910
public static void rebindCasConfigurationProperties ( final ConfigurationPropertiesBindingPostProcessor binder , final ApplicationContext applicationContext ) { val map = applicationContext . getBeansOfType ( CasConfigurationProperties . class ) ; val name = map . keySet ( ) . iterator ( ) . next ( ) ; LOGGER . trace (...
Rebind cas configuration properties .
17,911
public File getStandaloneProfileConfigurationDirectory ( ) { val file = environment . getProperty ( "cas.standalone.configurationDirectory" , File . class ) ; if ( file != null && file . exists ( ) ) { LOGGER . trace ( "Received standalone configuration directory [{}]" , file ) ; return file ; } return Arrays . stream ...
Gets standalone profile configuration directory .
17,912
protected Collection < SingleLogoutRequest > createLogoutRequests ( final String ticketId , final WebApplicationService selectedService , final RegisteredService registeredService , final Collection < SingleLogoutUrl > logoutUrls , final TicketGrantingTicket ticketGrantingTicket ) { return logoutUrls . stream ( ) . map...
Create logout requests collection .
17,913
protected SingleLogoutRequest createLogoutRequest ( final String ticketId , final WebApplicationService selectedService , final RegisteredService registeredService , final SingleLogoutUrl logoutUrl , final TicketGrantingTicket ticketGrantingTicket ) { val logoutRequest = DefaultSingleLogoutRequest . builder ( ) . ticke...
Create logout request logout request .
17,914
protected boolean sendSingleLogoutMessage ( final SingleLogoutRequest request , final SingleLogoutMessage logoutMessage ) { val logoutService = request . getService ( ) ; LOGGER . trace ( "Preparing logout request for [{}] to [{}]" , logoutService . getId ( ) , request . getLogoutUrl ( ) ) ; val msg = getLogoutHttpMess...
Send single logout message .
17,915
protected boolean sendMessageToEndpoint ( final LogoutHttpMessage msg , final SingleLogoutRequest request , final SingleLogoutMessage logoutMessage ) { return this . httpClient . sendMessageToEndPoint ( msg ) ; }
Send message to endpoint .
17,916
protected LogoutHttpMessage getLogoutHttpMessageToSend ( final SingleLogoutRequest request , final SingleLogoutMessage logoutMessage ) { return new LogoutHttpMessage ( request . getLogoutUrl ( ) , logoutMessage . getPayload ( ) , this . asynchronous ) ; }
Gets logout http message to send .
17,917
public String handle ( final Exception e , final RequestContext requestContext ) { val messageContext = requestContext . getMessageContext ( ) ; if ( e instanceof AuthenticationException ) { return handleAuthenticationException ( ( AuthenticationException ) e , requestContext ) ; } if ( e instanceof AbstractTicketExcep...
Maps an authentication exception onto a state name . Also sets an ERROR severity message in the message context .
17,918
protected void checkSubjectRolesAndPermissions ( final Subject currentUser ) throws FailedLoginException { if ( this . requiredRoles != null ) { for ( val role : this . requiredRoles ) { if ( ! currentUser . hasRole ( role ) ) { throw new FailedLoginException ( "Required role " + role + " does not exist" ) ; } } } if (...
Check subject roles and permissions .
17,919
protected AuthenticationHandlerExecutionResult createAuthenticatedSubjectResult ( final Credential credential , final Subject currentUser ) { val username = currentUser . getPrincipal ( ) . toString ( ) ; return createHandlerResult ( credential , this . principalFactory . createPrincipal ( username ) ) ; }
Create authenticated subject result .
17,920
protected String extractPrincipalId ( final Credential credentials , final Optional < Principal > currentPrincipal ) { val wsFedCredentials = ( WsFederationCredential ) credentials ; val attributes = wsFedCredentials . getAttributes ( ) ; LOGGER . debug ( "Credential attributes provided are: [{}]" , attributes ) ; val ...
Extracts the principalId .
17,921
@ View ( name = "by_username" , map = "function(doc) { if(doc.username){ emit(doc.username, doc) } }" ) public CouchDbProfileDocument findByUsername ( final String username ) { return queryView ( "by_username" , username ) . stream ( ) . findFirst ( ) . orElse ( null ) ; }
Find profile by username .
17,922
@ View ( name = "by_linkedid" , map = "function(doc) { if(doc.linkedid){ emit(doc.linkedid, doc) } }" ) public CouchDbProfileDocument findByLinkedid ( final String linkedid ) { return queryView ( "by_linkedid" , linkedid ) . stream ( ) . findFirst ( ) . orElse ( null ) ; }
Find profile by linkedid .
17,923
public Collection < RegisteredService > load ( ) { LOGGER . trace ( "Loading services from [{}]" , serviceRegistry . getName ( ) ) ; this . services = this . serviceRegistry . load ( ) . stream ( ) . collect ( Collectors . toConcurrentMap ( r -> { LOGGER . debug ( "Adding registered service [{}]" , r . getServiceId ( )...
Load services that are provided by the DAO .
17,924
@ View ( name = "by_recordKey" , map = "function(doc) { if (doc.principal && doc.deviceFingerprint && doc.recordDate) { emit(doc.recordKey, doc) } }" ) public CouchDbMultifactorAuthenticationTrustRecord findByRecordKey ( final String recordKey ) { return db . queryView ( createQuery ( "by_recordKey" ) . key ( recordKey...
Find by recordKey .
17,925
@ View ( name = "by_recordDate" , map = "function(doc) { if (doc.principal && doc.deviceFingerprint && doc.recordDate) { emit(doc.recordDate, doc) } }" ) public List < CouchDbMultifactorAuthenticationTrustRecord > findOnOrBeforeDate ( final LocalDateTime recordDate ) { return db . queryView ( createQuery ( "by_recordDa...
Find by recordDate on of before date .
17,926
public List < CouchDbMultifactorAuthenticationTrustRecord > findOnOrAfterDate ( final LocalDateTime onOrAfterDate ) { return db . queryView ( createQuery ( "by_recordDate" ) . startKey ( onOrAfterDate ) , CouchDbMultifactorAuthenticationTrustRecord . class ) ; }
Find record created on or after date .
17,927
@ View ( name = "by_principal" , map = "function(doc) { if (doc.principal && doc.deviceFingerprint && doc.recordDate) { emit(doc.principal, doc) } }" ) public List < CouchDbMultifactorAuthenticationTrustRecord > findByPrincipal ( final String principal ) { val view = createQuery ( "by_principal" ) . key ( principal ) ;...
Find by principal name .
17,928
@ View ( name = "by_principal_date" , map = "function(doc) { if (doc.recordKey && doc.principal && doc.deviceFingerprint && doc.recordDate) { emit([doc.principal, doc.recordDate], doc) } }" ) public List < CouchDbMultifactorAuthenticationTrustRecord > findByPrincipalAfterDate ( final String principal , final LocalDateT...
Find by principal on or after date .
17,929
protected Map < String , List < Object > > convertAttributesToPrincipalAttributesAndCache ( final Principal principal , final Map < String , List < Object > > sourceAttributes , final RegisteredService registeredService ) { val finalAttributes = convertPersonAttributesToPrincipalAttributes ( sourceAttributes ) ; addPri...
Convert attributes to principal attributes and cache .
17,930
protected static Map < String , List < Object > > convertPersonAttributesToPrincipalAttributes ( final Map < String , List < Object > > attributes ) { return attributes . entrySet ( ) . stream ( ) . collect ( Collectors . toMap ( Map . Entry :: getKey , Map . Entry :: getValue ) ) ; }
Convert person attributes to principal attributes .
17,931
protected Map < String , List < Object > > getPrincipalAttributes ( final Principal principal ) { if ( ignoreResolvedAttributes ) { return new HashMap < > ( 0 ) ; } return convertPrincipalAttributesToPersonAttributes ( principal . getAttributes ( ) ) ; }
Gets principal attributes .
17,932
protected RegisteredService getRegisteredServiceFromFile ( final File file ) { val fileName = file . getName ( ) ; if ( fileName . startsWith ( "." ) ) { LOGGER . trace ( "[{}] starts with ., ignoring" , fileName ) ; return null ; } if ( Arrays . stream ( getExtensions ( ) ) . noneMatch ( fileName :: endsWith ) ) { LOG...
Gets registered service from file .
17,933
protected void decideIfCredentialPasswordShouldBeReleasedAsAttribute ( final Map < String , List < Object > > attributes , final Authentication authentication , final RegisteredService service ) { val policy = service . getAttributeReleasePolicy ( ) ; val isAuthorized = policy != null && policy . isAuthorizedToReleaseC...
Decide if credential password should be released as attribute . The credential must have been cached as an authentication attribute and the attribute release policy must be allowed to release the attribute .
17,934
protected void decideIfProxyGrantingTicketShouldBeReleasedAsAttribute ( final Map < String , List < Object > > attributes , final Map < String , Object > model , final RegisteredService service ) { val policy = service . getAttributeReleasePolicy ( ) ; val isAuthorized = policy != null && policy . isAuthorizedToRelease...
Decide if PGT should be released as attribute . The PGT must have been cached as an authentication attribute and the attribute release policy must be allowed to release the attribute .
17,935
protected void decideAttributeReleaseBasedOnServiceAttributePolicy ( final Map < String , List < Object > > attributes , final String attributeValue , final String attributeName , final RegisteredService service , final boolean doesAttributePolicyAllow ) { if ( StringUtils . isNotBlank ( attributeValue ) ) { LOGGER . d...
Decide attribute release based on service attribute policy .
17,936
protected String determinePrincipalId ( final RequestContext requestContext , final Credential credential ) { if ( StringUtils . isBlank ( properties . getJdbc ( ) . getPrincipalIdAttribute ( ) ) ) { return credential . getId ( ) ; } val principal = WebUtils . getAuthentication ( requestContext ) . getPrincipal ( ) ; v...
Extracts principal ID from a principal attribute or the provided credentials .
17,937
public static ClientConfiguration buildClientConfiguration ( final BaseAmazonWebServicesProperties props ) { val cfg = new ClientConfiguration ( ) ; cfg . setConnectionTimeout ( props . getConnectionTimeout ( ) ) ; cfg . setMaxConnections ( props . getMaxConnections ( ) ) ; cfg . setRequestTimeout ( props . getRequestT...
Build client configuration .
17,938
private List filterAttributes ( final List < Object > valuesToFilter , final String attributeName ) { return valuesToFilter . stream ( ) . filter ( this :: patternMatchesAttributeValue ) . peek ( attributeValue -> logReleasedAttributeEntry ( attributeName , attributeValue ) ) . collect ( Collectors . toList ( ) ) ; }
Filter array attributes .
17,939
private boolean patternMatchesAttributeValue ( final Object value ) { val matcher = value . toString ( ) ; LOGGER . trace ( "Compiling a pattern matcher for [{}]" , matcher ) ; return this . compiledPattern . matcher ( matcher ) . matches ( ) ; }
Determine whether pattern matches attribute value .
17,940
private void logReleasedAttributeEntry ( final String attributeName , final Object attributeValue ) { LOGGER . debug ( "The attribute value [{}] for attribute name [{}] matches the pattern [{}]. Releasing attribute..." , attributeValue , attributeName , this . compiledPattern . pattern ( ) ) ; }
Logs the released attribute entry .
17,941
protected InputStream getResourceInputStream ( final Resource resource , final String entityId ) throws IOException { LOGGER . debug ( "Locating metadata resource from input stream." ) ; if ( ! resource . exists ( ) || ! resource . isReadable ( ) ) { throw new FileNotFoundException ( "Resource does not exist or is unre...
Retrieve the remote source s input stream to parse data .
17,942
public void buildMetadataResolverAggregate ( final String entityId ) { LOGGER . trace ( "Building metadata resolver aggregate" ) ; this . metadataResolver = new ChainingMetadataResolver ( ) ; val resolvers = new ArrayList < MetadataResolver > ( ) ; val entries = this . metadataResources . entrySet ( ) ; entries . forEa...
Build metadata resolver aggregate . Loops through metadata resources and attempts to resolve the metadata .
17,943
private List < MetadataResolver > loadMetadataFromResource ( final MetadataFilter metadataFilter , final Resource resource , final String entityId ) { LOGGER . debug ( "Evaluating metadata resource [{}]" , resource . getFilename ( ) ) ; try ( val in = getResourceInputStream ( resource , entityId ) ) { if ( in . availab...
Load metadata from resource .
17,944
private List < MetadataResolver > buildSingleMetadataResolver ( final MetadataFilter metadataFilterChain , final Resource resource , final Document document ) { try { val metadataRoot = document . getDocumentElement ( ) ; val metadataProvider = new DOMMetadataResolver ( metadataRoot ) ; metadataProvider . setParserPool...
Build single metadata resolver .
17,945
public static AuthenticationBuilder newInstance ( final Authentication source ) { val builder = new DefaultAuthenticationBuilder ( source . getPrincipal ( ) ) ; builder . setAuthenticationDate ( source . getAuthenticationDate ( ) ) ; builder . setCredentials ( source . getCredentials ( ) ) ; builder . setSuccesses ( so...
Creates a new builder initialized with data from the given authentication source .
17,946
public AuthenticationBuilder setCredentials ( final List < CredentialMetaData > credentials ) { this . credentials . clear ( ) ; this . credentials . addAll ( credentials ) ; return this ; }
Sets the list of metadata about credentials presented for authentication .
17,947
protected boolean doesEndingTimeAllowServiceAccess ( ) { if ( this . endingDateTime != null ) { val et = DateTimeUtils . zonedDateTimeOf ( this . endingDateTime ) ; if ( et != null ) { val now = ZonedDateTime . now ( ZoneOffset . UTC ) ; if ( now . isAfter ( et ) ) { LOGGER . warn ( "Service access not allowed because ...
Does ending time allow service access boolean .
17,948
protected boolean doesStartingTimeAllowServiceAccess ( ) { if ( this . startingDateTime != null ) { val st = DateTimeUtils . zonedDateTimeOf ( this . startingDateTime ) ; if ( st != null ) { val now = ZonedDateTime . now ( ZoneOffset . UTC ) ; if ( now . isBefore ( st ) ) { LOGGER . warn ( "Service access not allowed b...
Does starting time allow service access boolean .
17,949
protected Optional < ExpirationPolicy > getExpirationPolicyFor ( final TicketState ticketState ) { val name = getExpirationPolicyNameFor ( ticketState ) ; LOGGER . trace ( "Received expiration policy name [{}] to activate" , name ) ; if ( StringUtils . isNotBlank ( name ) && policies . containsKey ( name ) ) { val poli...
Gets expiration policy by its name .
17,950
public static SPSSODescriptor getSPSsoDescriptor ( final EntityDescriptor entityDescriptor ) { LOGGER . trace ( "Locating SP SSO descriptor for SAML2 protocol..." ) ; var spssoDescriptor = entityDescriptor . getSPSSODescriptor ( SAMLConstants . SAML20P_NS ) ; if ( spssoDescriptor == null ) { LOGGER . trace ( "Locating ...
Gets SP SSO descriptor .
17,951
public static SamlMetadataUIInfo locateMetadataUserInterfaceForEntityId ( final MetadataResolverAdapter metadataAdapter , final String entityId , final RegisteredService registeredService , final HttpServletRequest requestContext ) { val entityDescriptor = metadataAdapter . getEntityDescriptorForEntityId ( entityId ) ;...
Locate MDUI for entity id simple metadata ui info .
17,952
public static SamlMetadataUIInfo locateMetadataUserInterfaceForEntityId ( final EntityDescriptor entityDescriptor , final String entityId , final RegisteredService registeredService , final HttpServletRequest requestContext ) { val mdui = new SamlMetadataUIInfo ( registeredService , requestContext . getLocale ( ) . get...
Locate mdui for entity id simple metadata ui info .
17,953
@ View ( name = "by_serviceId" , map = "function(doc) { if (doc.service) { emit(doc.service.serviceId, doc._id) }}" ) public RegisteredServiceDocument findByServiceId ( final String serviceId ) { return queryView ( "by_serviceId" , serviceId ) . stream ( ) . findFirst ( ) . orElse ( null ) ; }
Implements search by serviceId .
17,954
@ View ( name = "by_serviceName" , map = "function(doc) { if (doc.service) { emit(doc.service.name, doc._id) }}" ) public RegisteredServiceDocument findByServiceName ( final String serviceName ) { try { return queryView ( "by_serviceName" , serviceName ) . stream ( ) . findFirst ( ) . orElse ( null ) ; } catch ( final ...
Implements search by service name .
17,955
public RegisteredServiceDocument get ( final long id ) { try { return this . get ( String . valueOf ( id ) ) ; } catch ( final DocumentNotFoundException e ) { LOGGER . debug ( "Service [{}] not found. [{}]" , id , e . getMessage ( ) ) ; return null ; } }
Overload wrapper for long type . Get service by ID .
17,956
@ View ( name = "size" , map = "function(doc) { if (doc.service) { emit(doc, doc._id) }}" , reduce = "_count" ) public int size ( ) { val r = db . queryView ( createQuery ( "size" ) ) ; LOGGER . trace ( "r.isEmpty [{}]" , r . isEmpty ( ) ) ; LOGGER . trace ( "r.getRows [{}]" , r . getRows ( ) ) ; if ( r . isEmpty ( ) )...
Size of the service database .
17,957
private static String getRequestBody ( final HttpServletRequest request ) { val body = readRequestBodyIfAny ( request ) ; if ( ! StringUtils . hasText ( body ) ) { LOGGER . trace ( "Looking at the request attribute [{}] to locate SAML request body" , SamlProtocolConstants . PARAMETER_SAML_REQUEST ) ; return ( String ) ...
Gets the request body from the request .
17,958
public static < T > T registerBeanIntoApplicationContext ( final ConfigurableApplicationContext applicationContext , final Class < T > beanClazz , final String beanId ) { val beanFactory = applicationContext . getBeanFactory ( ) ; val provider = beanFactory . createBean ( beanClazz ) ; beanFactory . initializeBean ( pr...
Register bean into application context .
17,959
public static < T > T registerBeanIntoApplicationContext ( final ConfigurableApplicationContext applicationContext , final T beanInstance , final String beanId ) { val beanFactory = applicationContext . getBeanFactory ( ) ; if ( beanFactory . containsBean ( beanId ) ) { return ( T ) applicationContext . getBean ( beanI...
Register bean into application context t .
17,960
public static Optional < CasConfigurationProperties > getCasConfigurationProperties ( ) { if ( CONTEXT != null ) { return Optional . of ( CONTEXT . getBean ( CasConfigurationProperties . class ) ) ; } return Optional . empty ( ) ; }
Gets cas properties .
17,961
protected Map < String , List < Object > > getCachedPrincipalAttributes ( final Principal principal , final RegisteredService registeredService ) { try { val cache = getCacheInstanceFromApplicationContext ( ) ; return cache . getCachedAttributesFor ( registeredService , this , principal ) ; } catch ( final Exception e ...
Gets cached principal attributes .
17,962
public PrincipalAttributesRepositoryCache getCacheInstanceFromApplicationContext ( ) { val ctx = ApplicationContextProvider . getApplicationContext ( ) ; return ctx . getBean ( "principalAttributesRepositoryCache" , PrincipalAttributesRepositoryCache . class ) ; }
Gets cache instance from application context .
17,963
protected void createGoogleAppsPrivateKey ( ) throws Exception { if ( ! isValidConfiguration ( ) ) { LOGGER . debug ( "Google Apps private key bean will not be created, because it's not configured" ) ; return ; } val bean = new PrivateKeyFactoryBean ( ) ; if ( this . privateKeyLocation . startsWith ( ResourceUtils . CL...
Create the private key .
17,964
protected void createGoogleAppsPublicKey ( ) throws Exception { if ( ! isValidConfiguration ( ) ) { LOGGER . debug ( "Google Apps public key bean will not be created, because it's not configured" ) ; return ; } val bean = new PublicKeyFactoryBean ( ) ; if ( this . publicKeyLocation . startsWith ( ResourceUtils . CLASSP...
Create the public key .
17,965
protected ActionState createTerminateSessionActionState ( final Flow flow ) { val actionState = createActionState ( flow , CasWebflowConstants . STATE_ID_TERMINATE_SESSION , CasWebflowConstants . ACTION_ID_TERMINATE_SESSION ) ; createTransitionForState ( actionState , CasWebflowConstants . TRANSITION_ID_WARN , CasWebfl...
Create terminate session action state .
17,966
protected void createLogoutViewState ( final Flow flow ) { val logoutView = createEndState ( flow , CasWebflowConstants . STATE_ID_LOGOUT_VIEW , "casLogoutView" ) ; logoutView . getEntryActionList ( ) . add ( createEvaluateAction ( CasWebflowConstants . ACTION_ID_LOGOUT_VIEW_SETUP ) ) ; }
Create logout view state .
17,967
protected void createFrontLogoutActionState ( final Flow flow ) { val actionState = createActionState ( flow , CasWebflowConstants . STATE_ID_FRONT_LOGOUT , createEvaluateAction ( "frontChannelLogoutAction" ) ) ; createTransitionForState ( actionState , CasWebflowConstants . TRANSITION_ID_FINISH , CasWebflowConstants ....
Create front logout action state .
17,968
private void createDoLogoutActionState ( final Flow flow ) { val actionState = createActionState ( flow , CasWebflowConstants . STATE_ID_DO_LOGOUT , createEvaluateAction ( "logoutAction" ) ) ; createTransitionForState ( actionState , CasWebflowConstants . TRANSITION_ID_FINISH , CasWebflowConstants . STATE_ID_FINISH_LOG...
Create do logout action state .
17,969
protected void createLogoutConfirmationView ( final Flow flow ) { val view = createViewState ( flow , CasWebflowConstants . STATE_ID_CONFIRM_LOGOUT_VIEW , "casConfirmLogoutView" ) ; createTransitionForState ( view , CasWebflowConstants . TRANSITION_ID_SUCCESS , CasWebflowConstants . STATE_ID_TERMINATE_SESSION ) ; }
Create logout confirmation view .
17,970
public CouchDbSamlMetadataDocument merge ( final SamlMetadataDocument document ) { setId ( document . getId ( ) ) ; setName ( document . getName ( ) ) ; setValue ( document . getValue ( ) ) ; setSignature ( document . getSignature ( ) ) ; return this ; }
Merge other into this .
17,971
@ PostMapping ( value = "/v1/tickets/{tgtId:.+}" , consumes = MediaType . APPLICATION_FORM_URLENCODED_VALUE ) public ResponseEntity < String > createServiceTicket ( final HttpServletRequest httpServletRequest , @ RequestBody ( required = false ) final MultiValueMap < String , String > requestBody , @ PathVariable ( "tg...
Create new service ticket .
17,972
public static X509Certificate readCertificate ( final Resource resource ) { try ( val in = resource . getInputStream ( ) ) { return CertUtil . readCertificate ( in ) ; } catch ( final Exception e ) { throw new IllegalArgumentException ( "Error reading certificate " + resource , e ) ; } }
Read certificate x 509 certificate .
17,973
public static StringWriter transformSamlObject ( final OpenSamlConfigBean configBean , final XMLObject samlObject ) throws SamlException { return transformSamlObject ( configBean , samlObject , false ) ; }
Transform saml object into string without indenting the final string .
17,974
public static StringWriter transformSamlObject ( final OpenSamlConfigBean configBean , final XMLObject samlObject , final boolean indent ) throws SamlException { val writer = new StringWriter ( ) ; try { val marshaller = configBean . getMarshallerFactory ( ) . getMarshaller ( samlObject . getElementQName ( ) ) ; if ( m...
Transform saml object to String .
17,975
public static BasicCredential buildCredentialForMetadataSignatureValidation ( final Resource resource ) throws Exception { try { val x509FactoryBean = new BasicX509CredentialFactoryBean ( ) ; x509FactoryBean . setCertificateResource ( resource ) ; x509FactoryBean . afterPropertiesSet ( ) ; return x509FactoryBean . getO...
Build credential for metadata signature validation basic credential .
17,976
public static String logSamlObject ( final OpenSamlConfigBean configBean , final XMLObject samlObject ) throws SamlException { val repeat = "*" . repeat ( SAML_OBJECT_LOG_ASTERIXLINE_LENGTH ) ; LOGGER . debug ( repeat ) ; try ( val writer = transformSamlObject ( configBean , samlObject , true ) ) { LOGGER . debug ( "Lo...
Log saml object .
17,977
@ GetMapping ( path = WSFederationConstants . ENDPOINT_FEDERATION_METADATA ) public void doGet ( final HttpServletRequest request , final HttpServletResponse response ) throws Exception { try { response . setContentType ( MediaType . TEXT_HTML_VALUE ) ; val out = response . getWriter ( ) ; val metadata = WSFederationMe...
Get Metadata .
17,978
public CouchDbConsentDecision copyDetailsFrom ( final ConsentDecision other ) { setAttributes ( other . getAttributes ( ) ) ; setPrincipal ( other . getPrincipal ( ) ) ; setCreatedDate ( other . getCreatedDate ( ) ) ; setId ( other . getId ( ) ) ; setOptions ( other . getOptions ( ) ) ; setReminder ( other . getReminde...
Copy consent details to this instance .
17,979
public static OidcClientRegistrationResponse getClientRegistrationResponse ( final OidcRegisteredService registeredService , final String serverPrefix ) { val clientResponse = new OidcClientRegistrationResponse ( ) ; clientResponse . setApplicationType ( registeredService . getApplicationType ( ) ) ; clientResponse . s...
Gets client registration response .
17,980
public static String getClientConfigurationUri ( final OidcRegisteredService registeredService , final String serverPrefix ) throws URISyntaxException { return new URIBuilder ( serverPrefix . concat ( '/' + OidcConstants . BASE_OIDC_URL + '/' + OidcConstants . CLIENT_CONFIGURATION_URL ) ) . addParameter ( OidcConstants...
Gets client configuration uri .
17,981
public static ResponseEntity < String > createResponseEntityForAuthnFailure ( final AuthenticationException e , final HttpServletRequest request , final ApplicationContext applicationContext ) { try { val authnExceptions = e . getHandlerErrors ( ) . values ( ) . stream ( ) . map ( ex -> mapExceptionToMessage ( e , requ...
Create response entity for authn failure response .
17,982
private static PublicKey createRegisteredServicePublicKey ( final RegisteredService registeredService ) { if ( registeredService . getPublicKey ( ) == null ) { LOGGER . debug ( "No public key is defined for service [{}]. No encoding will take place." , registeredService ) ; return null ; } val publicKey = registeredSer...
Create registered service public key defined .
17,983
private static Cipher initializeCipherBasedOnServicePublicKey ( final PublicKey publicKey , final RegisteredService registeredService ) { try { LOGGER . debug ( "Using service [{}] public key [{}] to initialize the cipher" , registeredService . getServiceId ( ) , registeredService . getPublicKey ( ) ) ; val cipher = Ci...
Initialize cipher based on service public key .
17,984
public String encode ( final String data , final Optional < RegisteredService > service ) { try { if ( service . isPresent ( ) ) { val registeredService = service . get ( ) ; val publicKey = createRegisteredServicePublicKey ( registeredService ) ; val result = encodeInternal ( data , publicKey , registeredService ) ; i...
Encrypt using the given cipher associated with the service and encode the data in base 64 .
17,985
protected void loadSamlMetadataIntoRequestContext ( final RequestContext requestContext , final String entityId , final RegisteredService registeredService ) { LOGGER . debug ( "Locating SAML MDUI for entity [{}]" , entityId ) ; val mdui = MetadataUIUtils . locateMetadataUserInterfaceForEntityId ( this . metadataAdapte...
Load saml metadata into request context .
17,986
protected void verifyRegisteredService ( final RequestContext requestContext , final RegisteredService registeredService ) { if ( registeredService == null || ! registeredService . getAccessStrategy ( ) . isServiceAccessAllowed ( ) ) { LOGGER . debug ( "Service [{}] is not recognized/allowed by the CAS service registry...
Verify registered service .
17,987
protected String getEntityIdFromRequest ( final RequestContext requestContext ) { val request = WebUtils . getHttpServletRequestFromExternalWebflowContext ( requestContext ) ; return request . getParameter ( this . entityIdParameterName ) ; }
Gets entity id from request .
17,988
protected boolean locateMatchingHttpRequest ( final Authentication authentication , final HttpServletRequest request ) { if ( StringUtils . isNotBlank ( bypassProperties . getHttpRequestRemoteAddress ( ) ) ) { if ( httpRequestRemoteAddressPattern . matcher ( request . getRemoteAddr ( ) ) . find ( ) ) { LOGGER . debug (...
Locate matching http request and determine if bypass should be enabled .
17,989
public static Document produceMetadataDocument ( final CasConfigurationProperties config ) { try { val wsfedIdp = config . getAuthn ( ) . getWsfedIdp ( ) ; val sts = wsfedIdp . getSts ( ) ; val prop = CryptoUtils . getSecurityProperties ( sts . getRealm ( ) . getKeystoreFile ( ) , sts . getRealm ( ) . getKeystorePasswo...
Produce metadata document .
17,990
public long delete ( final List < TicketDocument > ticketDocuments ) { return ( long ) db . executeBulk ( ticketDocuments . stream ( ) . map ( BulkDeleteDocument :: of ) . collect ( Collectors . toList ( ) ) ) . size ( ) ; }
Delete tickets .
17,991
protected < T extends SAMLObject > void prepareSamlOutboundProtocolMessageSigningHandler ( final MessageContext < T > outboundContext ) throws Exception { LOGGER . trace ( "Attempting to sign the outbound SAML message..." ) ; val handler = new SAMLOutboundProtocolMessageSigningHandler ( ) ; handler . setSignErrorRespon...
Prepare saml outbound protocol message signing handler .
17,992
protected < T extends SAMLObject > void prepareSamlOutboundDestinationHandler ( final MessageContext < T > outboundContext ) throws Exception { val handlerDest = new SAMLOutboundDestinationHandler ( ) ; handlerDest . initialize ( ) ; handlerDest . invoke ( outboundContext ) ; }
Prepare saml outbound destination handler .
17,993
protected < T extends SAMLObject > void prepareEndpointURLSchemeSecurityHandler ( final MessageContext < T > outboundContext ) throws Exception { val handlerEnd = new EndpointURLSchemeSecurityHandler ( ) ; handlerEnd . initialize ( ) ; handlerEnd . invoke ( outboundContext ) ; }
Prepare endpoint url scheme security handler .
17,994
protected < T extends SAMLObject > void prepareSecurityParametersContext ( final SamlRegisteredServiceServiceProviderMetadataFacade adaptor , final MessageContext < T > outboundContext , final SamlRegisteredService service ) { val secParametersContext = outboundContext . getSubcontext ( SecurityParametersContext . clas...
Prepare security parameters context .
17,995
protected < T extends SAMLObject > void prepareOutboundContext ( final T samlObject , final SamlRegisteredServiceServiceProviderMetadataFacade adaptor , final MessageContext < T > outboundContext , final String binding , final RequestAbstractType authnRequest ) throws SamlException { LOGGER . trace ( "Outbound saml obj...
Prepare outbound context .
17,996
protected SignatureSigningParameters buildSignatureSigningParameters ( final RoleDescriptor descriptor , final SamlRegisteredService service ) { val criteria = new CriteriaSet ( ) ; val signatureSigningConfiguration = getSignatureSigningConfiguration ( descriptor , service ) ; criteria . add ( new SignatureSigningConfi...
Build signature signing parameters signature signing parameters .
17,997
protected PrivateKey getSigningPrivateKey ( ) throws Exception { val samlIdp = casProperties . getAuthn ( ) . getSamlIdp ( ) ; val signingKey = samlIdPMetadataLocator . getSigningKey ( ) ; val privateKeyFactoryBean = new PrivateKeyFactoryBean ( ) ; privateKeyFactoryBean . setLocation ( signingKey ) ; privateKeyFactoryB...
Gets signing private key .
17,998
public void handleRegisteredServiceExpiredEvent ( final CasRegisteredServiceExpiredEvent event ) { val registeredService = event . getRegisteredService ( ) ; val contacts = registeredService . getContacts ( ) ; val mail = casProperties . getServiceRegistry ( ) . getMail ( ) ; val sms = casProperties . getServiceRegistr...
Handle registered service expired event .
17,999
public static HttpServletRequest getHttpServletRequestFromRequestAttributes ( ) { try { return ( ( ServletRequestAttributes ) RequestContextHolder . currentRequestAttributes ( ) ) . getRequest ( ) ; } catch ( final Exception e ) { LOGGER . trace ( e . getMessage ( ) , e ) ; } return null ; }
Gets http servlet request from request attributes .