當前位置: 首頁>>代碼示例>>Java>>正文


Java UmaClient類代碼示例

本文整理匯總了Java中org.xdi.oxauth.client.uma.wrapper.UmaClient的典型用法代碼示例。如果您正苦於以下問題:Java UmaClient類的具體用法?Java UmaClient怎麽用?Java UmaClient使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


UmaClient類屬於org.xdi.oxauth.client.uma.wrapper包,在下文中一共展示了UmaClient類的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: init

import org.xdi.oxauth.client.uma.wrapper.UmaClient; //導入依賴的package包/類
@BeforeClass
@Parameters({"umaMetaDataUrl", "umaPatClientId", "umaPatClientSecret"})
public void init(final String umaMetaDataUrl, final String umaPatClientId, final String umaPatClientSecret) throws Exception {
    this.metadata = UmaClientFactory.instance().createMetadataService(umaMetaDataUrl, clientExecutor(true)).getMetadata();
    assert_(this.metadata);

    pat = UmaClient.requestPat(tokenEndpoint, umaPatClientId, umaPatClientSecret, clientExecutor(true));
    assert_(pat);

    this.registerResourceTest = new RegisterResourceFlowHttpTest(this.metadata);
    this.registerResourceTest.pat = this.pat;

    this.permissionFlowTest = new UmaRegisterPermissionFlowHttpTest(this.metadata);
    this.permissionFlowTest.registerResourceTest = this.registerResourceTest;

    this.rptStatusService = UmaClientFactory.instance().createRptStatusService(metadata, clientExecutor(true));
    this.tokenService = UmaClientFactory.instance().createTokenService(metadata, clientExecutor(true));
}
 
開發者ID:GluuFederation,項目名稱:oxAuth,代碼行數:19,代碼來源:AccessProtectedResourceFlowHttpTest.java

示例2: init

import org.xdi.oxauth.client.uma.wrapper.UmaClient; //導入依賴的package包/類
@BeforeClass
@Parameters({"umaMetaDataUrl", "umaPatClientId", "umaPatClientSecret"})
public void init(final String umaMetaDataUrl, final String umaPatClientId, final String umaPatClientSecret) throws Exception {
    if (this.metadata == null) {
        this.metadata = UmaClientFactory.instance().createMetadataService(umaMetaDataUrl, clientExecutor(true)).getMetadata();
        UmaTestUtil.assert_(this.metadata);
    }

    pat = UmaClient.requestPat(tokenEndpoint, umaPatClientId, umaPatClientSecret, clientExecutor(true));
    UmaTestUtil.assert_(pat);
}
 
開發者ID:GluuFederation,項目名稱:oxAuth,代碼行數:12,代碼來源:RegisterResourceFlowHttpTest.java

示例3: testObtainPatTokenFlow

import org.xdi.oxauth.client.uma.wrapper.UmaClient; //導入依賴的package包/類
/**
 * Test for the obtaining UMA PAT token
 */
@Test
@Parameters({"umaPatClientId", "umaPatClientSecret"})
public void testObtainPatTokenFlow(final String umaPatClientId, final String umaPatClientSecret) throws Exception {
    showTitle("testObtainPatTokenFlow");

    m_pat = UmaClient.requestPat(tokenEndpoint, umaPatClientId, umaPatClientSecret);
    UmaTestUtil.assert_(m_pat);
}
 
開發者ID:GluuFederation,項目名稱:oxAuth,代碼行數:12,代碼來源:ObtainPatTokenFlowHttpTest.java

示例4: test

import org.xdi.oxauth.client.uma.wrapper.UmaClient; //導入依賴的package包/類
@Test
@Parameters({"umaPatClientId", "umaPatClientSecret"})
public void test(final String umaPatClientId, final String umaPatClientSecret) throws Exception {

    final Token authorization = UmaClient.requestPat(tokenEndpoint, umaPatClientId, umaPatClientSecret);
    final Token tokenToIntrospect = UmaClient.requestPat(tokenEndpoint, umaPatClientId, umaPatClientSecret);

    final IntrospectionService introspectionService = ClientFactory.instance().createIntrospectionService(introspectionEndpoint);
    final IntrospectionResponse introspectionResponse = introspectionService.introspectToken("Bearer " + authorization.getAccessToken(), tokenToIntrospect.getAccessToken());
    Assert.assertTrue(introspectionResponse != null && introspectionResponse.isActive());
}
 
開發者ID:GluuFederation,項目名稱:oxAuth,代碼行數:12,代碼來源:IntrospectionWsHttpTest.java

示例5: getPassportConfig

import org.xdi.oxauth.client.uma.wrapper.UmaClient; //導入依賴的package包/類
@POST
@Produces({MediaType.APPLICATION_JSON})
public Response getPassportConfig(@FormParam(OxTrustConstants.OXAUTH_ACCESS_TOKEN) final String rpt) throws Exception{
	PassportConfigResponse passportConfigResponse = null;
	try{
		RptStatusService rptStatusService = UmaClientFactory.instance().createRptStatusService(metadataConfiguration);			
		String umaPatClientId = applicationConfiguration.getOxAuthClientId();
		String umaPatClientSecret = applicationConfiguration.getOxAuthClientPassword();
		
		if (umaPatClientSecret != null) {
			try {
				umaPatClientSecret = StringEncrypter.defaultInstance().decrypt(umaPatClientSecret, cryptoConfigurationSalt);
			} catch (EncryptionException ex) {
				log.error("Failed to decrypt client password", ex);
			}
		}
		
		String tokenEndpoint = metadataConfiguration.getTokenEndpoint();			
		Token patToken = UmaClient.requestPat(tokenEndpoint, umaPatClientId, umaPatClientSecret);
		
		if((patToken != null) ){			
			RptIntrospectionResponse tokenStatusResponse = rptStatusService.requestRptStatus(
	                    "Bearer " + patToken.getAccessToken(),
	                    rpt, "");
			
			if((tokenStatusResponse != null) && (tokenStatusResponse.getActive())){
				passportConfigResponse = new PassportConfigResponse();
				LdapOxPassportConfiguration ldapOxPassportConfiguration = oxPassportService.loadConfigurationFromLdap();
				List<org.xdi.config.oxtrust.PassportConfiguration>  passportConfigurations  =ldapOxPassportConfiguration.getPassportConfigurations();
				Map  <String ,PassportStrategy> PassportConfigurationsMap = new HashMap<String, PassportStrategy>();
				for(org.xdi.config.oxtrust.PassportConfiguration passportConfiguration : passportConfigurations){			
					if(passportConfiguration.getProvider().equalsIgnoreCase("passport")){
						passportConfigResponse.setApplicationEndpoint((passportConfiguration.getApplicationEndpoint()==null) ? "" : passportConfiguration.getApplicationEndpoint() );	
						passportConfigResponse.setAuthenticationUrl((passportConfiguration.getServerURI()==null) ? "" : passportConfiguration.getServerURI());
						passportConfigResponse.setApplicationStartpoint((passportConfiguration.getApplicationStartpoint()==null) ? "" : passportConfiguration.getApplicationStartpoint());
						
					}else{
						PassportStrategy passportStrategy = new PassportStrategy();							
						passportStrategy.setClientID((passportConfiguration.getClientID()==null) ? "" : passportConfiguration.getClientID());
						passportStrategy.setClientSecret((passportConfiguration.getClientSecret()==null) ? "" : passportConfiguration.getClientSecret());
						PassportConfigurationsMap.put((passportConfiguration.getProvider()==null) ? "" : passportConfiguration.getProvider(), passportStrategy);
					}					
				}	
				passportConfigResponse.setPassportStrategies(PassportConfigurationsMap);
				return Response.status(Response.Status.OK).entity(passportConfigResponse).build();
				
			}else{
				log.info("Invalid GAT/RPT token. ");
				return Response.status(Response.Status.UNAUTHORIZED).build();
			}
			
		}else{
			log.info("Unable to get PAT token. ");	
			return Response.status(Response.Status.SERVICE_UNAVAILABLE).build();
		}
		
	}catch(Exception e){
		log.error("Exception Occured : {0} ", e.getMessage());
		e.printStackTrace();			
		return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build();
	}	
}
 
開發者ID:AgarwalNeha1,項目名稱:gluu,代碼行數:63,代碼來源:PassportRestWebService.java


注:本文中的org.xdi.oxauth.client.uma.wrapper.UmaClient類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。