本文整理汇总了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));
}
示例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);
}
示例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);
}
示例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());
}
示例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();
}
}