当前位置: 首页>>代码示例>>Java>>正文


Java UmaClient.requestPat方法代码示例

本文整理汇总了Java中org.xdi.oxauth.client.uma.wrapper.UmaClient.requestPat方法的典型用法代码示例。如果您正苦于以下问题:Java UmaClient.requestPat方法的具体用法?Java UmaClient.requestPat怎么用?Java UmaClient.requestPat使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.xdi.oxauth.client.uma.wrapper.UmaClient的用法示例。


在下文中一共展示了UmaClient.requestPat方法的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.requestPat方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。