I configured a secondary user store where I want to store all of my users.
Maybe I missed something because when I try to generate an access token for a user stored in the secondary user store I get an error.
curl -k -d "grant_type=password&username=<USR_NAME>&password=<USR_PASSWD>" -H "Authorization: Basic <BASE64_KEY_SECRET>" https://localhost:8243/token
The error response:
{"error_description":"Authentication failed for <USER_NAME>#carbon.super","error":"invalid_grant"}.
If I pass a user of the primary user store it returns the access token.
Any ideas?
Related
I'm working in an instance of AppDynamics where we enter using SSO, so we just type the name of our account and enter without an user/password.
I need to create a custom event and, according to this documentation https://docs.appdynamics.com/display/PRO43/Alert+and+Respond+API#AlertandRespondAPI-CreateaCustomEvent
what I would need is to run a curl like curl -X POST --user user1#customer1:secret 'http://demo.appdynamics.com/controller/rest/applications/5/events?severity=INFO&summary=test1&eventtype=CUSTOM&customeventtype=mycustomevent&propertynames=key1&propertynames=key2&propertyvalues=value1&propertyvalues=value'
Problem is, I don't have an user/password. If I don't type them I get a 401 as expected.
I can see in My Preferences my username, but I can't find any password in the application.
Is there something I could do to find that password or something that would work for that POST to work?
The credentials for an SSO user reside with the Identity Provider (on your side) not the Service Provider (AppDynamics).
So there are two options here:
Create (or ask an admin to create) an AppDynamics user in the Controller Administration UI. Then use the username / password from this user in your requests.
Create (or ask an admin to create) and API Client configuration in the Controller Administration UI. Then use the Access Token in your requests (Docs: https://docs.appdynamics.com/appd/22.x/latest/en/extend-appdynamics/appdynamics-apis/api-clients)
I am using WSO2 Identity Server 5.10 and API manger 3.2.
When I generate JWT access token, it does not contain required scopes wrt to the roles assigned to the user.
Role validation of the user is not happening during JWT token generation. All the scopes passed during token generation are been granted to the user without validating user roles.
When we generate JWT access token for a user say "operator" with only "view_role" by passing all the created scopes in the token api body like 'scope=openid,create_scope, view_scope, edit_scope'.
In token api response able to see all the scopes which are passed during token generation.
The issue is seen only on a HA setup not on single node setup.
Token Api curl:
curl --location --request POST 'https:///oauth2/token'
--header 'Content-Type: application/x-www-form-urlencoded'
--data-urlencode 'grant_type=password'
--data-urlencode 'password=xyz#123'
--data-urlencode 'username=abc#tenant.com'
--data-urlencode 'client_id=xxxxxx'
--data-urlencode 'client_secret=xxxxxx'
--data-urlencode 'scope=openid operator_access_scope admin_access_scope creater_access_scope
adaptor_admin_access_scope
Steps to reproduce:
Create different scopes associated with Roles(Ex: "create_scope" with "create" role associated, similarly edit_scope, view_scope) in publisher portal( APIM 3.2).
Assign the scopes to some resources.
Create new user with only "view" role assigned.
Generate JWT access token by passing all the scopes in the body (scope = openid, create_scope edit_scope view_scope)
Notice that all the scopes passed during token generation are granted even though user has only "view" role expected is only view_scope has to granted for the user.
My Requirement is: I need to pass all the scopes created under publisher portal to the token api but token should be granted with only those scopes which are relevant to roles assigned to the user. This behavior is working fine in one of our single node setup. Did I miss any configuration changes for HA setup. Please assist.
I'm trying to refresh the users auth token on the server in NextJS, currently I have the token set in cookies that I access like this:
export async function getServerSideProps(ctx) {
const cookies = nookies.get(ctx);
try {
const client = useClient(cookies.token);
// etc
}
}
unfortunately if the token has expired this will fail with the token has expired error.
I do have access to the refresh token but not sure how to use it, firebase.auth().currentUser is undefined in getServersideProps as well
I had similar issue using NuxtJS and the easiest way is to redirect user to a different page where you can get a new Firebase ID Token on client side and then refresh the cookie. For example, you may redirect to a page something like https://domain.tld/auth/refresh?redirect_uri=/dashboard. The query parameter redirect_uri tells where the user was and must be redirected back after refreshing the token.
If you want to avoid the redirect, you would have to store the "Refresh Token" on your server side. I am not sure how secure that will be but don't store refresh token in cookies. But just in case you are wondering how to get new Firebase ID Token using the refresh token, you can make a POST request to this URL:
https://securetoken.googleapis.com/v1/token?key=FirebasePublicAPIKey
The API key is available in your Firebase Config. The body for this POST request seems to be URL encoded and has grant_type and refresh_token fields.
Here's a cURL request for the same:
curl "https://securetoken.googleapis.com/v1/token?key=firebaseAPIKey" \
-H 'Content-Type: application/x-www-form-urlencoded' \
-X POST \
-F 'grant_type=refresh_token' \
-F 'refresh_token=firebaseRefreshToken'
I just used Chrome DevTools to check how tokens are refresh and found that.
The first method sounds safer to me and I personally use it over storing refresh tokens somewhere on server or cookies. In fact, I use custom JWT tokens from my server in cookies instead of Firebase ID Tokens themselves.
We want to disable UI access for our build users.
They can not use plain-text password for REST APIs for security reasons.
I am trying following to get encrypted password without allowing Build users UI access.
- I created one build user(Non admin with UI disabled)
- Created access token for that build user using admin account.
When I try to use Token to fetch encrypted password of build user I get following error.
ANYBRIDGEBUCK:~ jainish.shah$ curl -H "Authorization: Bearer $TOKEN" http://jainish.artifactory.com/artifactory/api/security/encryptedPassword
{
"errors" : [ {
"status" : 404,
"message" : "User not found: token:automation"
} ]
Is there any other way to get encrypted password without using plain-text password or via UI.
The Get User Encrypted Password REST API requires that the request needs to be authenticated using a clear-text password. i.e. when submitting the request to Artifactory, the password provided for authentication needs to be in clear-text.
The http API docs request that a special token be created for several operations (e.g. List Buckets, All Changes)
X-Simperium-Token — Authentication token must have been created using an API key that has admin privileges
How do I create this token?
I have tried a few things:
curl -H 'X-Simperium-Token: {my admin key}' https://api.simperium.com/1/{app_name}/buckets.
This results in the "meta" buckets {"buckets": [{"name": "exception"}, {"name": "code"}, {"name": "message"}]} which is kind of interesting.
curl -H 'X-Simperium-API-Key: {my admin key}' -d '{"username":"{valid user}", "password":"{valid password}"}' https://auth.simperium.com/1/{app_name}/authorize/.
Result: invalid app credentials
Authorize with my normal key, which works fine and gives me an access token which I can use for the other (non-admin) operations.
My thinking is that I need to pass in my admin key into 'authorize' somehow and generate an auth token blessed with admin privileges for this user (to list all of his buckets, for example).
Thanks in advance.
You should be able to use the admin key directly for the token anywhere that requires a token that was created with an API key with admin privileges. We're currently working on the UI to actually create these API keys with different options. In the meantime, you can either use the admin key from your dashboard directly, or contact us and we can create one for you.